/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-08-06     SY       the first version
 */
#ifndef APPLICATIONS_SY_UART_H_
#define APPLICATIONS_SY_UART_H_
#ifdef __cplusplus
extern "c"{
#endif

typedef struct _uart_dev
{
    rt_device_t uart_dev;
    rt_thread_t thread_id;
    rt_sem_t sem;
    void *buf;
    unsigned int buf_size;
    void (*callback)(void *arg,unsigned int arg_size);

}uart_dev;

typedef uart_dev *uart_t;

typedef struct _uart_config
{
    unsigned int baud;
    unsigned int read_size;
    unsigned int stack_size;
    unsigned int priority;
    unsigned int tick;
    void *buf;
    unsigned int buf_size;
    void (*callback)(void *arg,unsigned int size);

}uart_config_t;

typedef struct _uart3_rx_data
{
    unsigned char data[1500];
    unsigned int len;

}uart3_data_t;

int uart_init();
uart_t uart_create(char *dev_name,uart_config_t *config);
uart3_data_t *Get_Uart1Data();

rt_device_t Get_ZigbeeDev();
rt_device_t Get_Rs485Dev();

extern uart3_data_t uart3_data;

#ifdef __cplusplus
}
#endif
#endif /* APPLICATIONS_SY_UART1_H_ */
